<?php

namespace app\service;

use app\admin\model\Link as LinkModel;

class LinkService
{
    protected $model;
    protected $categoryService;

    public function __construct(){
        $this->model = app()->make(LinkModel::class);
    }

    /**
     * @param $where
     * @param int $type
     * @return LinkModel[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function queryListByType($type = 1)
    {
        return $this->model->where('type', $type)->field('id, name, type, target, url, created_time')->order('created_time desc')->select();
    }
}